﻿using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class ContinueFrt11Record : BiffRecord
    {
        private FrtHeader frtHeader;
        private byte[] rgb;

        protected override void ReadContent(BiffReaderContext context, int length)
        {
            this.frtHeader = new FrtHeader();
            frtHeader.Read(context.Reader);
            Contract.Assert(frtHeader._rt == 0x0875);
            this.rgb = context.ReadBytes(length - FrtHeader.Size);
        }

        internal override BiffRecordType RecordType
        {
            get { return BiffRecordType.ContinueFrt11; }
        }

        public IEnumerable<byte> Buffer
        {
            get {
                return rgb;
            }
        }

        internal override void WriteContent(BiffWriterWorkbookContext context)
        {
            this.frtHeader.Write(context);
            context.Write(rgb);
        }
    }
}